home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Business Heaven
/
Business Heaven.iso
/
maillist
/
zipcodes
/
demo.prg
< prev
next >
Wrap
Text File
|
1993-09-07
|
2KB
|
102 lines
* This is generic dBase III Code and will run within dBAse III and dBase IV
* To compile for Clipper:
* Clipper demo.prg
* RTLINK FI demo
SET CONFIRM ON
SET COLOR TO W/B
SET TALK OFF
SET SCOREBOARD OFF
SET BELL OFF
CLEAR
SET STATUS OFF
USE zipcodes
* Check for existance of ndx file. If it is not present, query ì
* for creation of file
IF .NOT. FILE("ZIPCODES.NDX") .AND. .NOT. FILE("ZIPCODES.NTX")
CLEAR
answer = "Y"
@ 1,1 SAY "You need an index file, requiring approximately 800K"
@ 2,1 SAY "of space:"
@ 2,10 SAY " Continue?" GET answer
READ
IF UPPER(answer) = "Y"
SET TALK ON
CLEAR
@ 12,36 SAY "Indexing"
INDEX ON zipcode TO zipcodes
SET TALK OFF
CLEAR
ELSE
CANCEL
ENDIF
ELSE
SET INDEX TO zipcodes
ENDIF
* Open address database
SELECT 2
USE demo
* Now enter data
APPEND BLANK
DO WHILE .T.
SELE 2
@ 3, 29 SAY "Help Software Demo"
@ 6, 9 SAY "First Name:"
@ 6, 26 GET demo->fname
@ 8, 9 SAY "Last Name:"
@ 8, 26 GET demo->lname
@ 10, 9 SAY "Address:"
@ 10, 26 GET demo->address
@ 12, 9 SAY "City:"
@ 12, 26 SAY demo->city
@ 14, 9 SAY "State:"
@ 14, 26 SAY demo->state
@ 14, 32 SAY "Zip Code:"
@ 14, 43 GET demo->zipcode
@ 16, 9 SAY "Phone:"
@ 16, 16 SAY demo->phone PICTURE "( ) - "
@ 2, 8 TO 18, 69
@ 4, 9 TO 4, 68
@ 19,27 SAY "Press ESC to Abort Program"
READ
* Check for ESC key
IF READKEY() = 12
EXIT
ENDIF
huntzip=zipcode
SELECT 1
* If no Zipcode, then loop back through the record
IF demo->zipcode = SPACE(5)
LOOP
ENDIF
FIND &huntzip
IF FOUND()
SELECT 2
*move data into database
REPLACE zipcode WITH A->zipcode,;
state WITH A->state,;
city WITH A->city
@ 12, 9 SAY "City:"
@ 12, 26 SAY demo->city
@ 14, 9 SAY "State:"
@ 14, 26 SAY demo->state
@ 16, 16 GET demo->phone PICTURE "(999) 999-9999"
READ
ELSE
@ 22,0
WAIT "That zip code is not on file...any key to continue"
ENDIF
@ 23,0 CLEAR TO 23,79
APPEND BLANK
ENDDO
CLOSE ALL